// outer shell for the actual stop alert input filter
{
Boolean boolRetVal;
boolRetVal = DoCustomModalAlertFilter(pdlgAlert,pevntAlert,psHit,STOP_ALERT); // call the actual modal filter as a separate function, to avoid optimizing compilers from messing up the SetCurrentA4 operation
return boolRetVal; // signal if processing is complete
// outer shell for the actual caution alert input filter
{
Boolean boolRetVal;
boolRetVal = DoCustomModalAlertFilter(pdlgAlert,pevntAlert,psHit,CAUTION_ALERT); // call the actual modal filter as a separate function, to avoid optimizing compilers from messing up the SetCurrentA4 operation
return boolRetVal; // signal if processing is complete
// outer shell for the actual note alert input filter
{
Boolean boolRetVal;
boolRetVal = DoCustomModalAlertFilter(pdlgAlert,pevntAlert,psHit,NOTE_ALERT); // call the actual modal filter as a separate function, to avoid optimizing compilers from messing up the SetCurrentA4 operation
return boolRetVal; // signal if processing is complete
RememberA4(); // remember the current A4 data segment pointer
#endif // !USESROUTINEDESCRIPTORS
umfAlert = NewModalFilterProc(CustomModalStopAlertFilter); // get a routine descriptor (or UniversalProcPtr for 68k) for the stop alert dialog filter function
ParamText("\pPairs",strError1,strError2,"\p");
(void) StopAlert(ALERT_ID,umfAlert);
DisposeRoutineDescriptor((UniversalProcPtr) umfAlert); // dispose of the routine descriptor
RememberA4(); // remember the current A4 data segment pointer
#endif // !USESROUTINEDESCRIPTORS
umfAlert = NewModalFilterProc(CustomModalCautionAlertFilter); // get a routine descriptor (or UniversalProcPtr for 68k) for the caution alert dialog filter function
ParamText("\pPairs",strMismatch,"\p","\p");
(void) CautionAlert(ALERT_ID,umfAlert);
DisposeRoutineDescriptor((UniversalProcPtr) umfAlert); // dispose of the routine descriptor
RememberA4(); // remember the current A4 data segment pointer
#endif // !USESROUTINEDESCRIPTORS
umfAlert = NewModalFilterProc(CustomModalNoteAlertFilter); // get a routine descriptor (or UniversalProcPtr for 68k) for the note alert dialog filter function
ParamText("\pPairs",strNoMismatch,"\p","\p");
(void) NoteAlert(ALERT_ID,umfAlert);
DisposeRoutineDescriptor((UniversalProcPtr) umfAlert); // dispose of the routine descriptor
boolRetVal = DoCustomModalDialogFilter(pdlgGeneric,pevntGeneric,psHit); // call the actual modal filter as a separate function, to avoid optimizing compilers from messing up the SetCurrentA4 operation
return boolRetVal; // signal if processing is complete
RememberA4(); // remember the current A4 data segment pointer
#endif // !USESROUTINEDESCRIPTORS
pdlogPairs = GetNewDialog(DITL_ID,NULL,(WindowPtr) -1); // bring in the dialog resource
if (pdlogPairs != NULL)
{
SetPort(pdlogPairs); // ensure the correct port is current
umfDialog = NewModalFilterProc(CustomModalDialogFilter); // get a routine descriptor (or UniversalProcPtr for 68k) for the custom dialog filter function
// set up radio buttons to a default value
for (sIndex = CURLY_BRACE_RADIO; sIndex <= COMMENT_RADIO; sIndex++)
{
// clear all radios
GetDialogItem(pdlogPairs,sIndex,&sDummy,&hdlogItem,&rectTemp); // get the item handle
hctrlTemp = (ControlHandle) hdlogItem; // get the control handle
SetControlValue(hctrlTemp,0); // turn the radio selection off
} // for sIndex
GetDialogItem(pdlogPairs,CURLY_BRACE_RADIO,&sDummy,&hdlogItem,&rectTemp); // get the item handle
hctrlItem = (ControlHandle) hdlogItem; // get the control handle
SetControlValue(hctrlItem,1); // select the radio
ShowWindow(pdlogPairs); // open a dialog box
SelectWindow(pdlogPairs); // make it visible
do
{
ModalDialog(umfDialog,&sHit); // wait until an item is hit
GetDialogItem(pdlogPairs,sHit,&sDummy,&hdlogItem,&rectTemp); // get item information
hctrlItem = (ControlHandle) hdlogItem; // get the control handle
switch (sHit)
{
case CURLY_BRACE_RADIO :
case SQUARE_BRACE_RADIO :
case PARENTHESIS_RADIO :
case DBL_QUOTE_RADIO :
case SNGL_QUOTE_RADIO :
case COMMENT_RADIO :
{
for (sIndex = CURLY_BRACE_RADIO; sIndex <= COMMENT_RADIO; sIndex++)
{
// clear all radios
GetDialogItem(pdlogPairs,sIndex,&sDummy,&hdlogItem,&rectTemp); // get the item handle
hctrlTemp = (ControlHandle) hdlogItem; // get the control handle
SetControlValue(hctrlTemp,0); // turn the radio selection off
} // for sIndex
SetControlValue(hctrlItem,1); // turn the one radio selection on
break;
} // case CURLY_BRACE_RADIO … COMMENT_RADIO
} // switch sHit
} // do
while ((sHit != OK_BUTTON) && (sHit != CANCEL_BUTTON));
// Get results after dialog
if (sHit == CANCEL_BUTTON)
{
boolRetVal = true;
} // if sHit
else
{
boolRetVal = false;
} // else if sHit
if (!boolRetVal)
{
sIndex = CURLY_BRACE_RADIO; // start at the first radio in this group
do
{
GetDialogItem(pdlogPairs,sIndex,&sDummy,&hdlogItem,&rectTemp); // get the item handle
hctrlItem = (ControlHandle) hdlogItem; // get the control handle
sTemp = GetControlValue(hctrlItem); // get the radio value
sIndex++;
} // do
while ((sTemp != 1) && (sIndex <= COMMENT_RADIO));
*piMode = sIndex - CURLY_BRACE_RADIO - 1;
boolRetVal = false;
} // if !boolRetVal
DisposeDialog(pdlogPairs); // flush the dialog out of memory
DisposeRoutineDescriptor((UniversalProcPtr) umfDialog); // dispose of the routine descriptor
} // if pdlogPairs
else
{
ReportError(pcallBBEdit,"\pUnable to continue:","\pCan't create the dialog box.");
lOldA4 = SetCurrentA4(); // setup A4 to point to global data segment
#endif // !USESROUTINEDESCRIPTORS
gumfBBEdit = NewModalFilterProc(pcallBBEdit->StandardFilter); // get a routine descriptor (or UniversalProcPtr for 68k) for the BBEdit standard dialog filter function
if (pcallBBEdit->version > 1)
{
oseTest = SysEnvirons(2,&serWorld); // the the system environment
if ((oseTest == noErr) && (serWorld.systemVersion >= (short) 0x0700))
{
// System 7.0 or later is available
pcallBBEdit->GetSelection(&lStartPos,&lEndPos,&lFirstChar); // get the current selection (if any)